FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["global-device-registry/deviceRegistrationService/deviceRegistrationService.csproj", "global-device-registry/deviceRegistrationService/"]
RUN dotnet restore "global-device-registry/deviceRegistrationService/deviceRegistrationService.csproj"
COPY . .
WORKDIR "/src/global-device-registry/deviceRegistrationService"
RUN dotnet build "deviceRegistrationService.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "deviceRegistrationService.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "deviceRegistrationService.dll"]